import App from '../App'

const msite = r => require.ensure([], () => r(require('../page/msite/msite')), 'msite')
const search = r => require.ensure([], () => r(require('../page/search/search')), 'search')
const publish = r => require.ensure([], () => r(require('../page/publish/publish')), 'publish')
const login = r => require.ensure([], () => r(require('../page/login/login')), 'login')
const good = r => require.ensure([], () => r(require('../page/good/good')), 'good')
const buy = r => require.ensure([], () => r(require('../page/buy/buy')), 'buy')
const paysuccess = r => require.ensure([], () => r(require('../page/pay/paysuccess')), 'pay')
const profile = r => require.ensure([], () => r(require('../page/profile/profile')), 'profile')
const info = r => require.ensure([], () => r(require('../page/profile/children/info')), 'info')
const setusername = r => require.ensure([], () => r(require('../page/profile/children/children/setusername')), 'setusername')
const address = r => require.ensure([], () => r(require('../page/profile/children/children/address')), 'address')
const add = r => require.ensure([], () => r(require('../page/profile/children/children/children/add')), 'add')
const addDetail = r => require.ensure([], () => r(require('../page/profile/children/children/children/children/addDetail')), 'addDetail')
const order = r => require.ensure([], () => r(require('../page/order/order')), 'order')
const orderDetail = r => require.ensure([], () => r(require('../page/order/children/orderDetail')), 'orderDetail')
const chat = r => require.ensure([], () => r(require('../page/chat/chat')), 'chat')
const message = r => require.ensure([], () => r(require('../page/message/message')), 'message')


export default [{
    path: '/',
    component: App, //顶层路由，对应index.html
    children: [ //二级路由。对应App.vue
        //地址为空时跳转home页面
        {
            path: '',
            redirect: '/msite'
        },
        //所有商品列表页
        {
            path: '/msite',
            component: msite,
            meta: { keepAlive: true },
        },
        //商品详情页
        {
            path: '/good',
            component: good,
            meta: { keepAlive: true },
        },
        //聊天
        {
            path: '/chat',
            component: chat,
          //  meta: { keepAlive: true },
        },
        //商品购买页
        {
            path: '/buy',
            component: buy,
            meta: { keepAlive: true },
        },
         //支付成功页
        {
            path: '/paysuccess',
            component: paysuccess
        },
        //搜索页
        {
            path: '/search/:geohash',
            component: search
        },
        //发布商品页
        {
            path: '/publish',
            component: publish
        },
         //消息列表页
        {
            path: '/message',
            component: message
        },
        //登录注册页
        {
            path: '/login',
            component: login
        },
        //个人信息页
        {
            path: '/profile',
            component: profile,
            children: [{
                path: 'info', //个人信息详情页
                component: info,
                children: [{
                    path: 'setusername',
                    component: setusername,
                },{
                    path: 'address',
                    component: address,     //编辑地址
                    children:[{
                        path:'add',
                        component:add,
                        children:[{
                            path:'addDetail',
                            component:addDetail
                        }]
                    }]
                }]
            }]
        },
        //修改密码页
        // {
        //     path: '/forget',
        //     component: forget
        // },
        //订单列表页
        {
            path: '/order',
            component: order,
            // children: [{
            //     path: 'orderDetail', //订单详情页
            //     component: orderDetail,
            // }, ]
        },
        //订单详情页页
        {
            path: '/orderDetail',
            component: orderDetail,
        },
    ]
}]
